import { v4 as uuidv4 } from 'uuid'

export const getUUID = () => {
  //先判断本地存储中是否已经有了UUID
  let uuid_token = localStorage.getItem('UUIDTOKEN')
  if (!uuid_token) {
    //没有则创建一个UUID
    uuid_token = uuidv4()
    //并存储在localStorage
    localStorage.setItem('UUIDTOKEN', uuid_token)
  }
  //有则返回UUID
  return uuid_token
}
